package com.qiye.pointsserver.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qiye.pointsserver.model.entity.Auther;
import com.qiye.pointsserver.model.entity.Pointslog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
* @author Lenovo
* @description 针对表【sys_pointslog(积分日志表)】的数据库操作Mapper
* @createDate 2025-07-09 16:41:28
* @Entity com.qiye.pointsserver.model.entity.Pointslog
*/
public interface PointslogMapper extends BaseMapper<Pointslog> {


    @Select("""
    SELECT *
    FROM sys_pointslog AS a
    WHERE
      (a.time > 0 OR a.time IS NULL)
      AND (#{userinfoId} IS NULL OR #{userinfoId} = '' OR a.userinfo_id LIKE CONCAT('%', #{userinfoId}, '%'))
      AND (#{keyword} IS NULL OR #{keyword} = '' OR a.type LIKE CONCAT('%', #{keyword}, '%'))
    ORDER BY a.create_time DESC
""")
    IPage<Pointslog>  searchPointsLog(Page<?> page, @Param("userinfoId") Integer userinfoId, @Param("keyword") String keyword);

}




